<template>
  <div class="Home">
    <h2 ref="subtitle">{{ title }}</h2>
    <div class="button" @click="handelCLick">点我获取Ref</div>
  </div>
</template>

<script>
export default {
  name: 'Home',
  props: {
    title: {
      type: String,
      default: () => 'Hello World ~'
    },

  },
  data() {
    return {
      subtitle: this.title
    }
  },
  methods: {
    handelCLick() {
      console.log(this.$refs.subtitle)
    }
  }
}
</script>